<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算器</title>
	</head>
	<body>
		<input type="text" name="" id="num1" value="" />
		<select name="" id="symbol">
			<option value="1">+</option>
			<option value="2">-</option>
			<option value="3">*</option>
			<option value="4">/</option>
		</select>
		<input type="text" name="" id="num2" value="" />=<input type="text" id="num3" />
		<button type="button" onclick="a()">重置</button>
		<button type="button" onclick="b()">提交</button>
		<form action="" method="">
			
		</form>
		<script type="text/javascript">
			var one=document.getElementById('num1').value;
			var Symbo=document.getElementById('symbol').value;
			var two=document.getElementById('num2').value;
			var aa=0;
			function b(){
				switch(Symbo){
					case '1':
					aa=(parseFloat(one)+parseFloat(two));
					break;
					case '2':
					aa=(parseFloat(one)-parseFloat(two));
					break;
					case '3':
					aa=(parseFloat(one)*parseFloat(two));
					break;
					case '4':
					aa=(parseFloat(one)/parseFloat(two));
					break;
				}
				num3.value=aa;
			}
			function a(){
				location.reload;
			}
		</script>
	</body>
</html>
